package edu.yctc.weblog.controller.rest.impl;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import edu.yctc.weblog.constant.URLConstant;
import edu.yctc.weblog.controller.rest.AdminRestController;
import edu.yctc.weblog.entity.AdminDO;
import edu.yctc.weblog.entity.ResultDO;
import edu.yctc.weblog.service.AdminService;
import edu.yctc.weblog.session.SessionContentHolder;

@RestController
@RequestMapping(URLConstant.S + URLConstant.ADMIN)
public class AdminRestControllerImpl implements AdminRestController {

    @Autowired
    private AdminService adminService;

    @Override
    @PostMapping(URLConstant.ADMIN_GET_ADMINDO)
    public ResultDO<AdminDO> getAdminDOById(HttpSession httpSession) {
        Long id = SessionContentHolder.getSignInUserIdBySessionId(httpSession.getId());
        return adminService.getAdminDOById(id);
    }

}
